package com.example.zs.mytest;

import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.Nullable;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;

import com.example.zs.mytest.util.CircleTransform;
import com.squareup.picasso.Picasso;

import butterknife.Bind;

/**
 * Created by zs
 * on ：2017年 03月 23日
 * Time：11:49
 * —————————————————————————————————————
 * About:
 * —————————————————————————————————————
 */
public class TestActivity extends MyBaseActivity{

    @Bind(R.id.image_main)
    ImageView imageView;
    private String imageUrl;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initContentView(R.layout.activity_main);

    }

    @Override
    public void init() {
        Log.d("my_base","init");
        imageView.setOnClickListener(this);
    }

    @Override
    public void initData() {
        Log.d("my_base","initData");
        imageUrl = "https://testwww.ibaodian.com/imgupload/information/despic/21501481510821167.jpg";
        Picasso.with(mActivity).load(imageUrl).transform(new CircleTransform()).placeholder(R.drawable.user_card_head).error(R.drawable.user_card_head).into(imageView);

    }

    @Override
    public void onClick(View v) {
        Log.d("my_base","onClick");
        Picasso.with(mActivity).load(imageUrl).resize(50,50).centerCrop().into(imageView);

    }
}
